package net.dao.impl;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import net.dao.HistogramDao;
import net.model.Histogram;

@Repository(value = "histogramDao")
public class HistogramDaoImpl implements HistogramDao {

	@Autowired
	SessionFactory sessionFactory;

	@Override
	public List<Histogram> getAllHistogram() {
		return sessionFactory.getCurrentSession()
				.createCriteria(Histogram.class).list();
	}

	@Override
	public void saveHistogram(Histogram histogram) {
		sessionFactory.getCurrentSession().saveOrUpdate(histogram);
	}

}
